/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_INI_H
#define MK_INI_H
#include "MkTypes.h"

class MkApi CMkIni
{
public:
    CMkIni();
    ~CMkIni();

    Uint32 LoadFile(const MkString& FilePathName);
    Uint32 Parse(const MkString& Content);
    Uint32 WriteFile(const MkString& FileName);
    const MkString& GetProfileString(const MkString& AppName, const MkString& KeyName, const MkString& DefaultValue) const;
    Uint32 GetProfileUint32(const MkString& AppName, const MkString& KeyName, const Uint32& DefaultValue = 0) const;
    double GetProfileDouble(const MkString& AppName, const MkString& KeyName, const double& DefaultValue = 0.0f) const;
    BOOL GetProfileBoolean(const MkString& AppName, const MkString& KeyName, const BOOL& DefaultValue = FALSE) const;
    const MkString& GetProfileString(const MkString& AppKeyName, const MkString& DefaultValue = "") const;
    Uint32 GetProfileUint32(const MkString& AppKeyName, const Uint32& DefaultValue = 0) const;
    double GetProfileDouble(const MkString& AppKeyName, const double& DefaultValue = 0.0f) const;
    BOOL GetProfileBoolean(const MkString& AppKeyName, const BOOL& DefaultValue = FALSE) const;
    Uint32 SetProfileString(const MkString& AppName, const MkString& KeyName, const MkString& StrValue);
    Uint32 SetProfileUint32(const MkString& AppName, const MkString& KeyName, const Uint32& uValue);
    Uint32 SetProfileDouble(const MkString& AppName, const MkString& KeyName, const double& dValue);
    Uint32 SetProfileBoolean(const MkString& AppName, const MkString& KeyName, const BOOL& bValue);
    Uint32 SetProfileString(const MkString& AppKeyName, const MkString& StrValue);
    Uint32 SetProfileUint32(const MkString& AppKeyName, const Uint32& uValue);
    Uint32 SetProfileDouble(const MkString& AppKeyName, const double& dValue);
    Uint32 SetProfileBoolean(const MkString& AppKeyName, const BOOL& bValue);
    Uint32 GetProfileAppNames(MkVectorString& VecAppNames);
    Uint32 GetProfileKeyNames(const MkString& AppName, MkVectorString& VecKeyNames);
protected:
private:
    MkMap<MkString, MkMapString>        m_MapAppKey;
};

#endif//! MK_INI_H
